package book;

import java.awt.print.Book;

/**
 * @Author @fiber-cloud
 * @Date 2025/7/13 15:08
 */
public class book {
    //书的属性应该包括：作者，价格，书名，类型，是否被借阅出去
    private String name;
    private String author;
    private int price;
    private String type;
    private boolean borrowing;//默认为false

    //开始写构造函数
    public book(String name, String author, int price, String type) {
        this.name = name;
        this.author = author;
        this.price = price;
        this.type = type;
    }

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getAuthor() {
        return author;
    }
    public void setAuthor(String author) {
        this.author = author;
    }
    public int getPrice() {
        return price;
    }
    public void setPrice(int price) {
        this.price = price;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public void setBorrowing(boolean borrowing) {
        this.borrowing = borrowing;
    }
    public boolean isBorrowing() {
        return borrowing;
    }

    //重写toString
    public String toString(){
        return "目前图书馆{"+
                "书名 = ‘" + name + '\'' +
                "，作者 = ’" + author + '\'' +
                "，价格 = ‘" + price + '\'' +
                "， 类型 = '" + type + '\'' +
                ((borrowing == true)?", 已被借出":" , 未被借出")  +
                '}';
    }

    public boolean getBorrowed() {
        return borrowing;
    }
}
